package com.all.play.mymd.activity;

import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.app.AlertDialog;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Toast;

import com.all.play.mymd.R;

public class MainActivity extends AppCompatActivity {

    private SwipeRefreshLayout srl;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        initView();
    }

    private void initView() {
        srl = (SwipeRefreshLayout) findViewById(R.id.srl);

        srl.setSize(SwipeRefreshLayout.DEFAULT);
        srl.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
            @Override
            public void onRefresh() {

            }
        });

        srl.setColorSchemeColors(ContextCompat.getColor(this,R.color.a),
                ContextCompat.getColor(this,R.color.b),
                ContextCompat.getColor(this,R.color.c));

        srl.setProgressBackgroundColorSchemeColor(ContextCompat.getColor(this,R.color.srlbg));
    }

    public void OnClick(View view){

        final AlertDialog.Builder builder=new AlertDialog.Builder(this);
        builder.setTitle("hashiqi");
        builder.setMessage("this is a test");

        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                Toast.makeText(MainActivity.this, "This is a Hashiqi", Toast.LENGTH_SHORT).show();
            }
        });

        builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {

            }
        });

        builder.show();
    }
}
